using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace EFCachingProvider.ScalableCache
{
    /// <summary>
    /// Cache Entry. Declared public so it can get Xml Serialized in SOP data store.
    /// </summary>
    public class CacheEntry
    {
        public CacheEntry() { }
        public CacheEntry(DateTime now)
        {
            TimeStamp = now;
        }
        /// <summary>
        /// Copy constructor.
        /// </summary>
        /// <param name="source"></param>
        public CacheEntry(CacheEntry source)
        {
            Value = source.Value;
            DependentEntitySets = source.DependentEntitySets;
            SlidingExpiration = source.SlidingExpiration;
            ExpirationTime = source.ExpirationTime;
            TimeStamp = source.TimeStamp;
        }
        /// <summary>
        /// Value.
        /// </summary>
        public object Value { get; set; }
        /// <summary>
        /// Dependent Entity Sets.
        /// </summary>
        public List<string> DependentEntitySets { get; set; }
        /// <summary>
        /// Sliding Expiration.
        /// </summary>
        public TimeSpan SlidingExpiration { get; set; }
        /// <summary>
        /// Expiration Time.
        /// </summary>
        public DateTime ExpirationTime { get; set; }
        /// <summary>
        /// Contains DateTime value that is used as key for the Timestamp record of this 
        /// CacheEntry in EntitiesByDate Store.
        /// </summary>
        public DateTime TimeStamp { get; set; }
    }
}
